package nju.mscs.data.object;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;

public class UserList implements Serializable{
	protected	ArrayList<User> userList = new ArrayList<User>();
	protected 	User search(String id){
		for(User u:userList)
			if(u.getId().equals(id))
				return u;
		return null;
	}
	protected void add(String n,String p ,String i,int t,int a){
		userList.add(	new User(n,p,i,t,a));
	}
	
	protected Iterator<User> getIterator(){
		return userList.iterator();
	}
	
	protected boolean delete(String id){
		return userList.remove(search(id));
	}

	protected boolean add(User object) {
		// TODO Auto-generated method stub
		synchronized(userList){//网络线程
		return userList.add(object);
		}
	}
}